<template>
	<image src="/static/loading.gif" v-if="isload"></image>
	<clockInput v-else :itemData="updateReq" :inputType="inputType"></clockInput>
</template>

<script>
	import {
		patriarchClockTaskItem
	} from '@/api/api.js'
	export default {
		data() {
			return {
				loading: "https://img.zcool.cn/community/0159625e4aaabea8012165181d6c7d.gif",
				isload: true,
				inputType: "update",
				updateReq: {
					taskSid: '',
					taskName: '',
					taskContent: '',
					taskScore: 0,
					taskType: 0,
					startTime: 0,
				}
			};
		},
		onLoad: function(options) {
			this.loadItem(options.task_sid)
		},
		methods: {
			loadItem(taskSID) {
				patriarchClockTaskItem(taskSID).then(res => {
					console.log(res.data)
					if (res.data.code != 0) {
						uni.showToast({
							icon: "none",
							title: res.data.message
						})
					} else {
						this.updateReq.taskType = res.data.data.task_type
						this.updateReq.taskSid = res.data.data.task_uuid
						this.updateReq.taskName = res.data.data.task_name
						this.updateReq.taskContent = res.data.data.task_content
						this.updateReq.taskScore = res.data.data.task_score
						this.updateReq.startTime = res.data.data.start_time
					}
					this.isload = false
				})

			}
		}
	};
</script>

<style>
	image {
		height: 100rpx;
		width: 100rpx;
		margin-top: 500rpx;
		margin-left: 340rpx;
	}
</style>